package com.readingtree.library.security;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created by Administrator on 2017/4/13.
 */
public class LoginFailureHandler extends SimpleUrlAuthenticationFailureHandler {

    private final static Logger LOGGER = LoggerFactory.getLogger(CustomInvocationSecurityMetadataSourceService.class);

    @Override
    public void onAuthenticationFailure(HttpServletRequest var1, HttpServletResponse response, AuthenticationException var3) throws IOException, ServletException{
        response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
        LOGGER.error("login failure! failure message is  "+ var3.getMessage());
    }

}
